package com.stone.zeus.component.grpc.test.benchmark;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.util.concurrent.TimeUnit;

/**
 * @author fujianjian
 * @date 2023/5/10 15:55
 **/
@Slf4j
public class HelloWorldBenchmark {


    @Benchmark
    @OutputTimeUnit(TimeUnit.SECONDS)
    public void wellHelloHere() {
        log.info("benchmark hello world");
    }

    public static void main(String[] args) throws RunnerException {
        Options opt = new OptionsBuilder()
                .include(HelloWorldBenchmark.class.getSimpleName())
                .forks(1).mode(Mode.Throughput).build();

        new Runner(opt).run();
    }

}
